package br.com.fox.iebav.dao;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.Query;

import br.com.fox.iebav.dao.abstractdao.AbstractDAO;
import br.com.fox.iebav.entity.Noticias;

@Stateless
public class NoticiaDAO extends AbstractDAO {

	private Query q = null;

	/**
	 * 
	 * @return  Lista de com todas as Noticias
	 */
	public List<Noticias> findAll() {

		q = entityManager.createQuery("FROM Noticias");
		@SuppressWarnings("unchecked") 
		List<Noticias> list = q.getResultList();

		if (list.isEmpty())
			return new ArrayList<Noticias>();
		else
			return list;
	}

}
